package com.example.blog.service.impl;

import com.example.blog.dao.CommentMapper;
import com.example.blog.pojo.Comment;
import com.example.blog.service.CommentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * name: 东北宋小宝
 * date: 2020/9/3
 */
@Service
public class CommentServiceImpl implements CommentService {
    @Resource
    private CommentMapper commentMapper;
    @Override
    public void saveComment(Comment comment) {
        if (comment.getParentCommentId() != null)
            comment.setBlogId(null);
        commentMapper.saveComment(comment);
    }

    @Override
    public void delComment(Long id) {
        commentMapper.deleteComment(id);
    }
}
